<?php
	function laySanPhamTheoDong($MaDong){
        $mysql_str1=mysql_query("Select * From sanpham Where MaDongSanPham='".$MaDong."'");
		while($rows=mysql_fetch_array($mysql_str1)){
			$mysql_str2=mysql_query("Select HinhAnh1 From daphuongtien Where MaDaPhuongTien='".$rows['MaSanPham']."'");
			$rows_image=mysql_fetch_assoc($mysql_str2);
			if($rows['Moi'])
				$new="new";
			else $new="";
			if($rows['DacBiet'])
				$special="special";
			else $special="";	
			
			if($rows_image){
?>
				<li>
					<a title="<?php echo $rows['TuaSanPham'];?>" href="/banhang/dienthoai/chitiet/chitiet.php?sp=<?php echo $rows['MaSanPham'];?>&nsx=<?php echo $rows['MaNhaSanXuat'];?>"><img alt="<?php echo $rows['TenSanPham'];?>" src="<?php echo $rows_image['HinhAnh1'];?>"></a>		
					
					<div class="mname">
						  <div class="extra <?php echo $special;?>"><?php echo $special;?></div>
						  <div class="extra <?php echo $new;?>"><?php echo $new;?></div>
						  <div class="nameproduct">
							  <strong><?php echo $rows['TenSanPham'];?></strong>
						  </div>
					</div>
					<div class="price">
						<span><?php echo number_format($rows['Gia'],3)." VNĐ";?></span>
					</div>
				</li>
<?php 		}else{?>
				<li>
					<a title="<?php echo $rows['TuaSanPham'];?>" href="/banhang/dienthoai/chitiet/chitiet.php?sp=<?php echo $rows['MaSanPham'];?>&nsx=<?php echo $rows['MaNhaSanXuat'];?>"><img alt="<?php echo $rows['TenSanPham'];?>" src="#"></a>		
					
					<div class="mname">
						  <div class="extra <?php echo $special;?>"><?php echo $special;?></div>
						  <div class="extra <?php echo $new;?>"><?php echo $new;?></div>
						  <div class="nameproduct">
							  <strong><?php echo $rows['TenSanPham'];?></strong>
						  </div>
					</div>
					<div class="price">
						<span><?php echo number_format($rows['Gia'],3)." VNĐ";?></span>
					</div>
				</li>
<?php		}
		}
	}
?>
